package com.cherrypt.api.common.enums;

import com.cherrypt.api.model.dataobject.Discount;
import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
public enum DiscountEnum {
    NORMAL(1, 1F, 1F, 1F, 0L, "1倍上传/1倍下载/1倍做种");

    private int id;
    private float upload;
    private float download;
    private float seed;
    private long limitTime;
    private String description;

    DiscountEnum(int id, float upload, float download, float seed, long limitTime, String description) {
        this.id = id;
        this.upload = upload;
        this.download = download;
        this.seed = seed;
        this.limitTime = limitTime;
        this.description = description;
    }

    public static Discount toDiscount(DiscountEnum discountEnum) {
        Discount discount = new Discount();
        discount.setId(discountEnum.getId());
        discount.setUpload(discountEnum.getUpload());
        discount.setDownload(discountEnum.getDownload());
        discount.setSeed(discountEnum.getSeed());
        discount.setDescription(discountEnum.getDescription());
        return discount;
    }
}
